<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<style>
.table th, .table td {text-align:left; }
</style>
<div>
<!-- Nav tabs -->
  <ul id="myTabs" class="nav nav-tabs" role="tablist">
    <li role="presentation" class="" onclick="location.href='<?=printUrl('Import','index', array('tab'=>'100city'))?>'"><a href="#100city" aria-controls="100city" role="tab" data-toggle="tab">100城市名单导入</a></li>
    <li role="presentation" class="" onclick="location.href='<?=printUrl('Import','index', array('tab'=>'timeUnitMoney'))?>'"><a href="#timeUnitMoney" aria-controls="timeUnitMoney" role="tab" data-toggle="tab">双月额度</a></li>
    <li role="presentation" class="" onclick="location.href='<?=printUrl('Import','index', array('tab'=>'action'))?>'"><a href="#action" aria-controls="action" role="tab" data-toggle="tab">标准动作</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
    <div role="tabpanel" class="tab-pane col-md-6 col-md-offset-3" id="100city">
    <form class="form-inline" action="<?php echo printUrl('Import','save');?>" method="post" enctype="multipart/form-data">
      <input type="hidden" name="type" id="type" value="1">
      <table class="table ">
        <thead>
          <tr>
            <th colspan="2">100城市名单导入</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><label for="year" class="control-label">年份：</label></td>
            <td>
                <select class="form-control" placeholder=".col-xs-4" id="year" name="year">
                  <?php foreach ($yearList as $k => $v) {?>
                  <option value="<?php echo $k;?>" <?php echo $where['year']==$k ? ' selected="selected"' : '';?>><?php echo $v;?></option>
                  <?php }?>
                </select>
            </td>
          </tr>
          <tr>
            <td><label for="timeUnit" class="control-label">请选择双月：</label></td>
            <td>
              <select class="form-control" placeholder=".col-xs-4" id="timeUnit" name="timeUnit">
                <?php foreach ($timeUnitList as $timeK => $timeV) {?>
                <option value="<?php echo $timeK; ?>" <?php echo $this->timeUnitModel->getNowTimeUnit()==$timeK ? ' selected="selected"' : '';?>><?php echo $timeV; ?></option>
                <?php } ?>
              </select>
            </td>
          </tr>
          <tr>
            <td><label for="inputFile" class="control-label">选择文件:</label></td>
            <td><input type="file" class="form-control" id="inputFile" name="inputFile"></td>
          </tr>
          <tr>
            <td><label for="tempTile" class="control-label">模板下载:</label></td>
            <td><a class="btn btn-default" href="public/template/100city.zip" role="button">下载</a></td>
          </tr>
          <tr>
            <td colspan="2">
              <button type="submit" class="btn btn-default btn-primary">提交</button>        
            </td>
            <td></td>
          </tr>
        </tbody>
      </table>
    </form>
    </div>
    <div role="tabpanel" class="tab-pane col-md-6 col-md-offset-3" id="timeUnitMoney">
      <form class="form-inline" action="<?php echo printUrl('Import','save');?>" method="post" enctype="multipart/form-data">
      <input type="hidden" name="type" id="type" value="2">
      <table class="table ">
        <thead>
          <tr>
            <th colspan="2">双月额度导入</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><label for="year" class="control-label">年份：</label></td>
            <td>
                <select class="form-control" placeholder=".col-xs-4" id="year" name="year">
                  <?php foreach ($yearList as $k => $v) {?>
                  <option value="<?php echo $k;?>" <?php echo $where['year']==$k ? ' selected="selected"' : '';?>><?php echo $v;?></option>
                  <?php }?>
                </select>
            </td>
          </tr>
          <tr>
            <td><label for="timeUnit" class="control-label">请选择双月：</label></td>
            <td>
              <select class="form-control" placeholder=".col-xs-4" id="timeUnit" name="timeUnit">
                <?php foreach ($timeUnitList as $timeK => $timeV) {?>
                <option value="<?php echo $timeK; ?>" <?php echo $this->timeUnitModel->getNowTimeUnit()==$timeK ? ' selected="selected"' : '';?>><?php echo $timeV; ?></option>
                <?php } ?>
              </select>
            </td>
          </tr>
          <tr>
            <td><label for="inputFile" class="control-label">选择文件:</label></td>
            <td><input type="file" class="form-control" id="inputFile" name="inputFile"></td>
          </tr>
          <tr>
            <td><label for="tempTile" class="control-label">模板下载:</label></td>
            <td><a class="btn btn-default" href="public/template/importMoney.zip" role="button">下载</a></td>
          </tr>
          <tr>
            <td colspan="2">
              <button type="submit" class="btn btn-default btn-primary">提交</button>        
            </td>
            <td></td>
          </tr>
        </tbody>
      </table>
    </form>
    </div>
    <div role="tabpanel" class="tab-pane col-md-8 col-md-offset-2" id="action">
        <div class="panel panel-default">
          <!-- Default panel contents -->
          <div class="panel-heading">
        <button class="btn btn-default btn-sm col-md-offset-10" role="button" onclick="newWindow('添加标准动作','<?php echo printUrl('Import','actionAdd');?>',400,400)">新增标准动作</button>
          </div>
            <form class="form-inline" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="GET">
              <input type="hidden" name="c" id="c" value="Import">
              <input type="hidden" name="m" id="m" value="index">
              <input type="hidden" name="tab" id="tab" value="action">
              <div class="form-group">
                <label class="" for="year">年份：</label>
                <select class="form-control" name="year" id="year">
                  <?php foreach ($yearList as $k => $v) {?>
                  <option value="<?php echo $k;?>" <?php echo $where['year']==$k ? ' selected="selected"' : '';?>><?php echo $v;?></option>
                  <?php }?>
                </select>
              </div>
              <div class="form-group">
                <label class="" for="timeUnit">双月：</label>
                <select class="form-control" name="timeUnit" id="timeUnit">
                  <option value="">选择双月</option>
                  <?php foreach ($timeUnitList as $timeK => $timeV) {?>
                  <option value="<?php echo $timeK; ?>" <?php echo $where['timeUnit']==$timeK ? ' selected="selected"' : '';?>><?php echo $timeV; ?></option>
                  <?php } ?>
                </select>
              </div>
              <button type="submit" class="btn btn-default">查询</button>
            </form>
          <table class="table">
            <thead>
              <tr>
                <th class="bg-primary">序号</th>
                <th class="bg-primary">所属双月</th>
                <th class="bg-primary">标准动作名称</th>
                <th class="bg-primary">当前状态</th>
                <th class="bg-primary">排序</th>
                <th class="bg-primary">操作</th>
              </tr>
            </thead>
            <tbody>
            <?php foreach($actionList as $k => $v): ?>
              <tr>
                <td><?php echo $v['id']; ?></td>
                <td><?php echo $v['timeUnitStr']; ?></td>
                <td><?php echo $v['name'];?></td>
                <td><?php echo $v['statusStr'];?></td>
                <td><?php echo $v['orderNum'];?></td>
                <td>
                <button class="btn btn-default btn-sm" type="button" onclick="newWindow('修改标准动作','<?php echo printUrl('Import','actionEdit',array('id'=>$v['id']));?>',400,400)">修改</button>
                <button class="btn btn-default btn-sm" type="button" onclick="ajaxConfirmSubmit('您确定<?=$v['status']==1?'关闭':'开启';?>此标准动作吗？','<?=printUrl('Import','actionStatus');?>',{'id':<?=$v['id']?>})"><?=$v['status']==1?'关闭':'开启';?></button>
                </td>
              </tr>
            <?php endforeach; ?>
            </tbody>
          </table>
        </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(function(){
  $('#myTabs a[href="#<?=$tab?>"]').tab('show') // Select tab by name
});
</script>
<?php $this->load->view('common/foot');?>